//
//  WeiboForwardCell.swift
//  zyqWeibo
//
//  Created by 张亚琼 on 15/7/3.
//  Copyright © 2015年 张亚琼. All rights reserved.
//

import UIKit
import FFAutoLayout

class WeiboForwardCell: WeiboCell {
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        // 初始化转发微博标签
        forwardLabel = UILabel(color: UIColor.darkGrayColor(), foneSize: 10, isMutileLine: true)
       // forwardLabel?.text = "这是转发微博转发微博转发微博转发微博转发微博转发微博转发微博"
        forwardLabel!.preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 16
        insertSubview(forwardLabel!, atIndex: 0)
        // 设置forwardButton的背景色
        forwardButton.backgroundColor = UIColor(white: 0.9, alpha: 1.0)
        insertSubview(forwardButton, atIndex: 0)
        
        
        //MARK: 自动布局
        // forwardButton，在文本框的左下，footerView的右上
        forwardButton.ff_AlignVertical(ff_AlignType.BottomLeft, referView: textsLabel, size: nil, offset: CGPoint(x: -12, y: 12))
        forwardButton.ff_AlignVertical(ff_AlignType.TopRight, referView: bottomView, size: nil)
        // forwardLabel 的自动布局，在forwardButton内部中上
        forwardLabel?.ff_AlignInner(ff_AlignType.TopLeft, referView: forwardButton, size: nil, offset: CGPoint(x: 12, y: 12))
        // 配图视图的约束，在forwardLabel的下方
        recordConstraint(pictureView.ff_AlignVertical(ff_AlignType.BottomLeft, referView: forwardLabel!, size: CGSize(width: 290, height: 90), offset: CGPoint(x: 0, y: 12)))
    }
    
    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // 懒加载
    lazy var forwardButton = UIButton()
}
